package zhongbo.java.air;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

@SpringBootApplication
@Slf4j
@MapperScan("zhongbo.java.air")
public class AirIngestion {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(AirIngestion.class);
        log.info("---- success ---- {}",context);
        System.out.println("http://localhost:8003/doc.html");
        System.out.println("http://localhost:8001/swagger-ui.html");

       String input = "订单号:ORDER_1234, 金额：￥99.99；订单号:ORDER_5678, 金额：￥199.99";
        Pattern pattern = Pattern.compile("(?<=订单号:)\\w+");
        Matcher matcher = pattern.matcher(input);
        while (matcher.find()) {
            System.out.println(matcher.group());
        }
//        // 修正后的合法 JSON 字符串
//        String json =
//                "{"
//                        + "\"type\":\"B744\","
//                        + "\"r\":\"N919CA\","
//                        + "\"trace\":[11192.88,40.656246,-73.776986,\"ground\",8.8,120.9,0,0,{\"type\":\"ADS_B\"}],"
//                        + "\"icao\":\"acb84d\","
//                        + "\"dbFlags\":\"8\","
//                        + "\"desc\":\"BOEING 747-400\","
//                        + "\"timestamp\":1743645145199"
//                        + "}";
//
//        RedisChanelPublisher redisLogChanelPublisher = context.getBean(RedisChanelPublisher.class);
//        redisLogChanelPublisher.broadcastA(json);

    }
}